/**
 * Created by Administrator on 2015/10/15.
 */
window.onload=function() {
    var url = getUrl();
    var userid=getUserId();
    //已付款
    $.jsonp({
        url: 'http://'+url+'/api/order/order_list?state='+1,
        data: {userId:userid},
        callbackParameter: "callback",
        success: function (data, textStatus, xOptions) {
            var complied_tpl = juicer($("#order1_tpl").text());
            var html = complied_tpl.render(data);
            $(".ma_con01").html(html);
        },
        error: function (xOptions, textStatus) {}
    });
    //待付款
    $(document).on("click",".nopay",function(){
        $.jsonp({
            url: 'http://'+url+'/api/order/order_list?state='+0,
            data: {userId:userid},
            callbackParameter: "callback",
            success: function (data, textStatus, xOptions) {
                var complied_tpl = juicer($("#order0_tpl").text());
                var html = complied_tpl.render(data);
                $(".ma_con02").html(html);
            },
            error: function (xOptions, textStatus) {}
        });
    });
    //已完成
    $(document).on("click",".doed",function(){
        $.jsonp({
            url: 'http://'+url+'/api/order/order_list?state='+4,
            data: {userId:userid},
            callbackParameter: "callback",
            success: function (data, textStatus, xOptions) {
                var complied_tpl = juicer($("#order4_tpl").text());
                var html = complied_tpl.render(data);
                $(".ma_con03").html(html);
            },
            error: function (xOptions, textStatus) {}
        });
    });

}
